1. Field of the Invention
This invention relates to actively monitoring the amount and rate at which work is both produced and consumed relative to a threshold value, and in particular to the consumer thread calculating a subset of the ‘N’ threads which can be placed in a temporary sleep condition, wherein the duration of sleep is determined to give the consumer thread processing time to catch up, keeping the process from being overrun. ‘N’ is the number of unique producer threads.
2. Description of Background
Before our invention in considering an environment in which there exists a processing systems wherein some number of threads ‘N’ produce work. These work requests are placed on a structure (for example, a stack).
In such a processing system there also exists a single consumer thread, which processes this work asynchronously. If all threads are dispatched relatively evenly, then it is quite possible, especially for larger values of ‘N’ that the consumer thread could be overrun and all available storage will be consumed with unprocessed requests.
Stopping all the producer threads until the consumer thread catches up completely stalls the entire process. As such it is more desirable to merely ‘slow up’ the producer threads enough to prevent the consumer thread from being overrun and compromise the processing system.
Determining a method to overcome these and other limitations gives rise to the present invention.